package com.aliwo.design.patterns.strategy.context;

import com.aliwo.design.patterns.strategy.ICouponDiscount;

import java.math.BigDecimal;

/**
 * @author xuyayuan
 * @description 策略模式获取上下文
 * @date 2021/9/9 11:39
 */
public class StrategyContext<T> {


    private ICouponDiscount<T> iCouponDiscount;

    public StrategyContext(ICouponDiscount<T> iCouponDiscount){
        this.iCouponDiscount = iCouponDiscount;
    }

    public BigDecimal discountAmount(T couponInfo, BigDecimal skuPrice) {
        return iCouponDiscount.discountAmount(couponInfo, skuPrice);
    }
}
